package com.example.controller;

import com.example.entity.Manager;
import com.example.serverce.ManagerService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author fyx
 */
@RestController
@RequestMapping("/managerUser")
public class ManagerController {
    private final ManagerService service;

    public ManagerController(ManagerService service) {
        this.service = service;
    }

    @GetMapping("/{id}")
    public Manager findById(@PathVariable int id) {
        final Manager manager = service.findById(id);
        if (manager == null) {
            throw new RuntimeException("未查询到该用户");

        }
        return manager;
    }
}
